package ru.usu.gv.gui.actions;

import ru.usu.gv.core.GraphCanvas;
import ru.usu.gv.uicomponents.UIEdge;
import ru.usu.gv.uicomponents.UIGraph;
import ru.usu.gv.uicomponents.UIVertex;

/**
 @author Sergey Pupyrev 
 11.01.2007
 */

public class AddEdgeAction extends ActionBase
{
	private UIVertex v1;
	private UIVertex v2;

	public AddEdgeAction(UIVertex vertex1, UIVertex vertex2)
	{
		v1 = vertex1;
		v2 = vertex2;
	}

	@Override
	public void execute()
	{
		UIGraph currentGraph = GraphCanvas.getInstance().getCurrentGraph();
		UIEdge edge = new UIEdge(v1, v2);
		currentGraph.addEdge(edge);
		edge.draw();
	}
}
